//
//  SampuxAddEquipmentViewController.m
//  Sampux
//
//  Created by rzm on 16/7/6.
//  Copyright © 2016年 rzm. All rights reserved.
//

#import "SampuxAddEquipmentViewController.h"
#import "SampuxAddEquipmentView.h"
#import "SampuxWiFiGuideViewController.h"
#import "SampuxDeployWiFiViewController.h"

@interface SampuxAddEquipmentViewController ()

@property (nonatomic, strong) SampuxAddEquipmentView *addView ;
@property (nonatomic, copy) NSString *failStr;

@end

@implementation SampuxAddEquipmentViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setHidesBackButton:YES];
    [self createAddView];
}

- (void)createAddView
{
     _addView = [[SampuxAddEquipmentView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
    [self.view addSubview:_addView];
    _addView.addEquipmentView.textFiled.text = self.account;
    __weak typeof(SampuxAddEquipmentViewController *) wSelf = self;

    _addView.nextStepBl = ^(NSString * seriesNumberStr){

        SampuxWiFiGuideViewController *documentVC = [[SampuxWiFiGuideViewController alloc]init];
        [wSelf.navigationController pushViewController:documentVC animated:YES];
        documentVC.numbStr = seriesNumberStr;
    };
}

- (void)addEqiupMentFail:(NSNotification *)notification
{
    NSLog(@"%@",notification.object);
    self.addView.numberString = notification.object;
    self.addView.addEquipmentView.textFiled.text = notification.object;
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:YES];
    self.addView.addEquipmentView.textFiled.text = @"";
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    SampuxCustomNavController *nav = (SampuxCustomNavController *)self.navigationController;
    nav.titleStr = @"手动输入";
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addEqiupMentFail:) name:@"addEqiupMentFail" object:nil];

}

- (void)sendNumberString:(NSString *)numberStr
{
    self.addView.numberString = numberStr;
}

//- (void)setAccount:(NSString *)account
//{
//    self.addView.numberString = account;
//}

@end
